#pragma once
#include <string>
#include <mysql_connection.h>
#ifdef _WIN32
#include <cppconn\driver.h>
#include <cppconn\resultset.h>
#else
#include "mysql_driver.h"
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#endif

namespace MySql
{
	class MySqlConnector
	{
	private:
		sql::Driver *mpDriver; // mysql driver
		sql::Connection *mpConnection; // mysql connection
	
	public:
		MySqlConnector(); // default constructor

		bool connect(std::string host, std::string userName, std::string password, unsigned int port = 3306); // open Connection

		void setSchema(std::string schema); // set database schema

		sql::ResultSet* execQuery(std::string query); // exec sql query that perform with select

		bool execute(std::string query); // exec sql query like : Drop create, delete

		int execUpdate(std::string query); // exec update query that update data

		~MySqlConnector(); // destroy connection
	};
}